package com.example.qx.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;

import com.example.qx.R;
import com.example.qx.lei.item;

import java.util.List;

public class cheduiadapter extends RecyclerView.Adapter<cheduiadapter.cheduiHolder> {
    private List<item> itemlist;
    public cheduiadapter(List<item> itemlist){
        this.itemlist=itemlist;
    }
    @NonNull
    @Override
    public cheduiHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.item,parent,false);
        return  new cheduiHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull cheduiadapter.cheduiHolder holder, int position) {
    item item=itemlist.get(position);
      holder.cheduiming.setText(item.getCheduiming());
        holder.cheduirenshu.setText(item.getCheduirenshu());}

    @Override
    public int getItemCount() {
        return itemlist.size();
    }
    public static class cheduiHolder extends RecyclerView.ViewHolder{
        private TextView cheduiming,cheduirenshu;
        public cheduiHolder(@Nullable View v){
            super(v);
            cheduiming=v.findViewById(R.id.cheduiming);
            cheduirenshu=v.findViewById(R.id.cheduirenshu);
        }


    }
}
